<?php
if (!defined('WEB_ROOT')) {
	exit;
}

// get all categories
$categories = fetchCategories();

// format the categories for display
$categories = formatCategories($categories, $catId);

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>

<table width="100%" border="0" cellspacing="0" cellpadding="2" class = "bright" align="top">
        <tr>
		<td></td>
		
<td valign="top">

<table width="100%" border="0" cellspacing="0" cellpadding="2" class = "category">
	<tr>
		<td class="bullet"></td>
		<td Style="width:128px;
height:24px;
padding-top:16px;
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
color:#FFF; background-color:inherit;

float:left;
margin:auto;"><a href="<?php echo $_SERVER['PHP_SELF']; ?>">CATEGORY</a></td>
	</tr>
<?php

foreach ($categories as $category) {
	extract($category);
	// now we have $cat_id, $cat_parent_id, $cat_name
	
	$level = ($cat_parent_id == 0) ? 1 : 2;
    $url   = $_SERVER['PHP_SELF'] . "?c=$cat_id";

	// for second level categories we print extra spaces to give
	// indentation look
	if ($level == 2) {
		$cat_name = '&nbsp; &nbsp; &raquo;&nbsp;' . $cat_name;
	}
	
	// assign id="current" for the currently selected category
	// this will highlight the category name
	$listId = '';
	if ($cat_id == $catId) {
		$listId = ' id="current"';
	}
	//<li<?php echo $listId; >><a href="<php echo $url; >"><php echo $cat_name; ></a></li>*/
	echo "<tr>";
?>
	<td class="bullet"><img src="resource/images/bullet1.jpg" alt=""/></td> 

	<td class="cbullet"><a href="<?php echo $url; ?>" class="ctxt"><?php echo $cat_name; ?></a></td> 

<?php
	echo "</tr>";
}
?>

</table>
</td>
</tr>
</table>
</td>
</tr>

<tr>
<td>
<?php 
$bannerList    = getBannerList();
$bannersPerCol = 2;
$numBanner     = count($bannerList);
$columnWidth    = "100%";

?>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td height="20">
</td>
</tr>

<?php 

if ($numBanner > 0) {
	$i = 0;
foreach ($bannerList as $banner) {
	extract($banner);
		
		// we have $url, $image, $name, $price

		//extract($bannerList[$i]);
	//	echo '<table>';
		echo '<tr class=\"bodycontainerright\">';
		echo "<td width=\"$columnWidth%\" align=\"center\" class=\"fpmleft\"><a href=\"$url\"><img src=\"$image\" border=\"0\" width=\"100\" height=\"100\"></a></td>";
		//echo $bannerList[$i]  ;
		
		echo '<tr>';
		echo '<td>';
		echo '<table cellpadding="15">';
		echo '<tr>';
		echo '<td height="20"  align="justify">';
		echo "$description<a href=\"$url\" class=\"rmore  fpmright\" > more...</a>";
		echo '</td>';
		echo '</tr>';
		echo '</table>';
		echo '</td>';
		echo '</tr>';
		

		
	}
	
} else {
?>
	<tr><td width="100%" align="center" valign="center">No banners yet</td></tr>
<?php	
}	
?>
</table>
</td>
</tr>
</table>
